package com.genshang.restaurant.controller;


import com.genshang.restaurant.result.ResultBody;
import com.genshang.restaurant.service.ICouponlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Alex
 * @since 2020-10-19
 */
@RestController
@RequestMapping("/couponlist")
public class CouponlistController {

    @Autowired
    private ICouponlistService couponlistService;

    /**
     * 核销优惠券
     *
     * @param id
     * @param operatorId
     * @return
     */
    @PostMapping("/exchangeCoupon")
    public ResultBody exchangeCoupon(String id, String operatorId) {
        return couponlistService.exchangeCoupon(id, operatorId);
    }

    @GetMapping("/getCouponList")
    public ResultBody getCouponList(Long currentPage, Long pageSize, String couponId, String couponType, String couponName, String personNumber, String phone) {
        return couponlistService.getCouponList(currentPage, pageSize, couponId, couponType, couponName, personNumber, phone);
    }
}
